<template>
  <x-tree :treeData="treeData" />
</template>

<script>
import XTree from '@/components/XTree'
import { getDeptTree } from '@/api/department'

export default {
  components: {
    XTree
  },
  data() {
    return {
      treeData: []
    }
  },
  mounted() {
    this.getDeptTree()
  },
  methods: {
    getDeptTree() {
      getDeptTree().then(res => {
        let arr = [
          {
            title: '部门',
            key: '',
            value: '',
            children: res.data
          }
        ]
        this.treeData = arr
      })
    }
  }
}
</script>